#coding:utf-8
"""
*   Coder    : Dzlua
*   Email    : 505544956@qq.com
*   Time     : 2017/09/29
"""
#--------------------#
from flask import url_for
from flask_sqlalchemy import SQLAlchemy
from flask_security import Security, login_required, auth_token_required, http_auth_required

#--------------------#
db = SQLAlchemy()
security = Security()

#--------------------#
def create_view_blueprint(name):
    from flask import Blueprint
    #
    blueprint = Blueprint(
        name,
        __name__,
        url_prefix='/' + name )
    #
    return blueprint
#----------#
def create_api_blueprint(name, prefix='api'):
    from flask import Blueprint
    #
    blueprint = Blueprint(
        prefix + '.' + name,
        __name__,
        url_prefix='/' + prefix + '/' + name )
    #
    return blueprint
#----------#
def register_blueprint(blueprint):
    from app import Mgr
    #
    Mgr.app.register_blueprint(blueprint)
#--------------------#
